<?php
$isReloadable = true;
require_once("../../../pers/inc.config.php");
require_once('../../_inc/inc.session.php');
require_once('../../_inc/funct.html.php');

$sql_sel = "SELECT m.cod_modulo, m.descr as m_descr "
		.", p.* "
		.", ri.cod_regola AS reg_inp "
		.", rv.cod_regola AS reg_val "
		.", ro.cod_regola AS reg_out "
		." FROM wfm_moduli m " 
		." LEFT JOIN wfm_pagine p ON p.id_modulo = m.id_modulo "
		." LEFT JOIN wfm_regole ri ON ri.id_regola = p.id_regola_inp "
		." LEFT JOIN wfm_regole rv ON rv.id_regola = p.id_regola_val "
		." LEFT JOIN wfm_regole ro ON ro.id_regola = p.id_regola_out "
		." WHERE m.id_modulo = ".reqVarInt('idm')
		." ORDER BY p.cod_pagina ";
$objDB->query($sql_sel,'selRec');
$acX = $objDB->fetch('selRec');
if (!$acX) {
	backOnErr("id '".reqVarInt('idm')."' errato");
}
$cmdL = "";
$cmdR = "&nbsp;&nbsp;&nbsp;";
if (true) {
	$cmdR .= "<a class=\"cmd1\" href=\"pagIns.php?idm=".reqVarInt('idm')."&$sXSNQS\">"._t("nuova pagina")."</a>";
}
$cmdR .= cmdTorna(); 

$sHtmlMod = "<table class=\"tab1\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\" align='center'>\n";
$sHtmlMod .= getHtmlRigaRif();
$sHtmlMod .= "<tr>\n";
$sHtmlMod .= "<td class='lab1' colspan='3'>Modulo</td>\n";
$sHtmlMod .= "<td class='txt1' colspan='3'>".$acX['cod_modulo']."</td>\n";
$sHtmlMod .= "<td class='txt1' colspan='14'>".$acX['m_descr']."</td>\n";
$sHtmlMod .= "</tr>\n";
$sHtmlMod .= "</table>";

$aOpz['sottotit'] = $sHtmlMod;

testaHtml('Gestione work-flow','Lista pagine', $msgPag, 'wfma', $aOpz);
echo getHtmlForm();
echo getHtmlHidden('xsn',XSN);
echo getHtmlHidden('startoffset');
?>
<table class="cmd1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="left">
         <?=$cmdL?>
      </td>
      <td class="cmd1" align="right">
         <?=$cmdR?>
      </td>
   </tr>
</table>
<table class="tab1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="lab1" width='1%' align='center'>ID</td>
      <td class="lab1" width='10%' align='center'>Codice</td>
      <td class="lab1" width='44%' align='center'>Descrizione</td>
      <td class="lab1" width='15%' align='center'>Regola input</td>
      <td class="lab1" width='15%' align='center'>Regola validaz.</td>
      <td class="lab1" width='15%' align='center'>Regola output</td>
   </tr>
<? 
$clRF = 'txt2';
if (!empty($acX['id_pagina'])) while($acX) { 
	$clRF = ($clRF=='txt1')?'txt2':'txt1';	
?>
   <tr>
      <td class="<?=$clRF?>" align="right"><? echo $acX['id_pagina'];?>&nbsp;</td>
      <td class="<?=$clRF?>" align="left">
      	<a href='pagView.php?id=<?=$acX['id_pagina']."&$sXSNQS"?>' class="<?=$clRF?>"
      	 	style='font-family:lucida console,courier;'><?echo $acX['cod_pagina'];?></a>
      </td>
      <td class="<?=$clRF?>"><? echo $acX['descr'];?></td>
      <td class="<?=$clRF?>" align="center">
      	<? echo (empty($acX['reg_inp']))?"&nbsp;":"reginp_".$acX['reg_inp'];?>
      </td>
      <td class="<?=$clRF?>" align="center">
      	<? echo (empty($acX['reg_val']))?"&nbsp;":"regval_".$acX['reg_val'];?>
      </td>
      <td class="<?=$clRF?>" align="center">
      	<? echo (empty($acX['reg_out']))?"&nbsp;":"regout_".$acX['reg_out'];?>
      </td>
   </tr>
<?php
	$acX = $objDB->fetch('selRec');
}
?>
</table>
<table class="cmd1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="left">
         <?=$cmdL?>
      </td>
      <td class="cmd1" align="right">
         <?=$cmdR?>
      </td>
   </tr>
</table>
<?
echo "</form>\n";
codaHtml();
exit();

